package org.atc.tools.ant.format;

import org.atc.tools.ant.Item;

import java.util.HashMap;
import java.util.Map;

/**
 * Wraps a formatted String
 * @author Alex Collins
 **/
public class FormattedItem {
	private String value;
	private Format format;
	private Item item;
	private Map<String, Object> properties = new HashMap<String, Object>();

	public Item getItem() {
		return item;
	}

	public void setItem(Item item) {
		this.item = item;
	}

	public void setValue(String value) {
		this.value = value;
	}

	public void setFormat(Format format) {
		this.format = format;
	}

	public Format getFormat() {
		return this.format;
	}

	public String getValue() {
		return this.value;
	}

	public void setProperty(String key, Object val) {
		this.properties.put(key, val);
	}

	public Object getProperty(String key) {
		return this.properties.get(key);
	}

	@Override
	public String toString() {
		return String.format("FormattedItem[%s, %s, %s, '%s']", format, item, value, properties);
	}
}
